package com.tm.d4_stringBuilder;

/**
 * 2024/5/23 StringBuilder字符串拼接 Cjj
 */
public class Test3 {
    public static void main(String[] args) {
        System.out.println(getArrayData(new int[]{11, 22, 33}));
    }

    public static String  getArrayData(int []arr ){
     if(arr==null){
       return null;
     }

        StringBuilder sb = new StringBuilder();
        sb.append("[");
        for (int i = 0; i < arr.length; i++) {
            if(i==arr.length-1){
                sb.append(arr[i]);
            }else {
                sb.append(arr[i]).append(",");
            }

        }
        sb.append("]");
      return sb.toString();
    }
}
